
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<span style="font-size:18px;">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="weddingPhotography/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="weddingPhotography/css/commonly-used-show.css" />
    <script type="text/javascript" src="weddingPhotography/js/jquery.min.js"></script>
    <script type="text/javascript" src="weddingPhotography/js/bootstrap.js" ></script>

    <title>${param.menu}</title>

</head>

<body class="mybody">

<jsp:include page="theTopMenuUser.jsp" />

<div class="container">
    <div class="frame">
        <h3 style="text-align: center">${param.menu}</h3>
        <hr style="filter: alpha(opacity=100,finishopacity=0,style=3)" width="100%" color="#6f5999" size="3"/>

        <div id="imgs" style="margin-left: 13%; margin-right: 10%">

        </div>


        <div class="text-center">
            <div>
                <label id="user_null" style="color: red"></label>
            </div>
        </div>

    </div>
</div>



<script type="text/javascript">
    var userdt = JSON.parse(sessionStorage.getItem("user"));
    var userNull = document.getElementById("user_null");
    if (userdt.result.userName != null){
        $("#usname").text(userdt.result.userName);
    }else {
        $("#usname").text(userdt.result.userLoginName);
    }

    window.onload = function(){
        photoInfo();
    }

    function photoInfo(){
        var postUrl = "${pageContext.request.contextPath}/member/selectUserLevelModuleNamePicture";
        var str = {
            "userLevel": "0",
            "moduleName": "${param.menu}"
        };

        $.ajax({
            type:"post",
            url:postUrl,
            headers: {
                "Content-Type":"application/json"
            },
            data:JSON.stringify(str),
            contentType: "application/json; charset=utf-8",
            dataType:"json",
            success:function(data){
                if (data.status == "0"){
                    alert(data.msg)
                }else if (data.result.length === 0){
                    userNull.innerHTML = "暂无图片数据";
                }else {
                    imgShow(data);
                }
            },
            error:function(xhr,state,errorThrown){
                //alert("发生网络错误，错误码为：" + xhr.status)
                location.href = "${pageContext.request.contextPath}/error";
            }
        });
    }

    function imgShow(list){

        var url = "${pageContext.request.contextPath}";


        var j = 0;
        for(var i = 0; i < list.result.length; i++){
            j++;
            $("#imgs").append("<img style='margin-bottom: 10px;' src='" + url + list.result[i].pictureUrl + "' width=\"200px\" height=\"200px\" > &nbsp;");
            if(j === 4){
                j = 0;
            }

        }
    }

</script>

</body>
</html>
</span>